<template>
  <basic-container :btnFlag=true>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>
      <div class="card-body">
        <avue-crud :data="subjectOpinionListData"
                   :option="tableoption"
                   :page="page"
                   :table-loading="tableLoading"
                   @on-load="getResultList"
                   @refresh-change="refreshChange"
                   @search-change="searchChange"
                   class="avuecrud">
          <template slot-scope="scope" slot="menu">
            <div class="menu-title" @click.stop="workingItemList(scope.row,scope.index)">
              <i class="iconfont iconview icon-primary"></i>
              <p class="menu-title-text">配置监测项</p>
            </div>
          </template>
        </avue-crud>
      </div>
    </div>
  </basic-container>
</template>

<script>
  import {decomposeDraftDetailList} from "@/api/pim/pim";

  export default {
    name: "programItemList",
    created(){
    },
    data(){
      return{
        headerData: {
          title: '分解方案详情'
        },
        subjectOpinionListData:[],
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 10 // 每页显示多少条
        },
        tableLoading:false,
        tableoption: {
          page: true,
          menuWidth: 130,
          addBtn: false,
          editBtn: false,
          addRowBtn: false,
          indexLabel: "序号",
          index: false,
  indexWidth:70,
          cellBtn: false,
          delBtn: false,
          columnBtn: false,
          refreshBtn: false,
          filterBtn: false,
          searchBtn: false,
          keyId: "id",
          column: [
            {
              label: "责任内容",
              width: 320,
              prop: "description",
              cell: true,
            },
            {
              label: "牵头部门",
              prop: "leadDeptName",
              cell: true
            },
            {
              label: "配合部门",
              prop: "cooDeptName",
              cell: true,
            },
            {
              label: "类型",
              prop: "type",
              cell: true,
              width: 130,
              dicData:[
                {
                  label:'指标',
                  value:'1'
                },{
                  label:'任务',
                  value:'2'
                },{
                  label:'项目',
                  value:'3'
                },
              ]
            },
          ]
        },
      }
    },
    methods: {
      searchChange() {

      },
      refreshChange() {

      },
      getResultList(page) {
        decomposeDraftDetailList(Object.assign({
          current: page.currentPage,
          size: page.pageSize,
          draftId:this.$route.params.id,
        })).then(response =>{
          this.subjectOpinionListData = response.data.data.records;
        })
      },
      //配置监测项
      workingItemList(row){
        let src = `/pim/workingItem/index/${row.id}`;
        this.$router.push({
          path: src,
          query:{
            pmuc:row.pmuc,
            planningTitle:row.planningTitle,
          }
        })
      },
    }

  }
</script>

<style scoped>

</style>
